package com.wtx.chapter14;

/**
 * @description: leetcode 387
 * @author: wtx
 * @createDate: 2020/6/2
 */
public class Solution387 {
    public int firstUniqChar(String s) {

        int[] freq = new int[26];
        for (char c : s.toCharArray())
            freq[c-'a']++;

        for (char c : s.toCharArray())
            if (freq[c-'a']==1)
                return s.indexOf(c);
        return -1;
    }
}
